package com.lw.common.config;

import cn.dev33.satoken.stp.StpInterface;
import com.lw.service.TbMenuService;
import com.lw.service.TbRoleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import java.util.List;

/**
 * saToken自定义权限加载接口实现类
 */
@Component
public class StpInterfaceImpl implements StpInterface {

    @Resource
    TbMenuService menuService;

    @Resource
    TbRoleService roleService;

    @Override
    public List<String> getPermissionList(Object loginId, String userId) {
        return menuService.getPerms((String) loginId);
    }

    @Override
    public List<String> getRoleList(Object loginId, String s) {
        return roleService.getRoleIds((String)loginId);
    }
}
